﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using IDAL;
using System.Data.SqlClient;
using System.Configuration;
/***************************
 * 数据访问层
 * 小区的状况数据
 * Author：JXL
 ***************************/ 
namespace DAL
{
    public class VillageDAL:BaseDAL, IVillageDAL
    {
        //public static string Conns = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;




        /// <summary>
        /// 小区状况添加
        /// </summary>
        /// <param name="mo"></param>
        /// <returns></returns>

        public int VillageAdd(Village mo)
        {
            using (SqlConnection conn = new SqlConnection(HouseCommon.Common.conn))
            {
                conn.Open();
                string sql = string.Format("insert into Village(ProjectNumber,Village_CaseName,Village_Cause,Village_Close,Village_Structure,Village_Traffic,Village_Green,Village_Volume,Village_Parking,Village_Property,Village_Explain,Village_CreateTime,Village_CreatePeople) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',GETDATE(),0)", mo.projectNumber, mo.village_CaseName, mo.village_Cause, mo.village_Close, mo.village_Structure, mo.village_Traffic, mo.village_Green, mo.village_Volume, mo.village_Parking, mo.village_Property, mo.village_Explain);
                SqlCommand cmd = new SqlCommand(sql,conn);
                int i = cmd.ExecuteNonQuery();
                conn.Close();
                return i;
            }
        }

        protected override string tablename
        {
            get { return "Village"; }
        }

        protected override Dictionary<string, bool> pkname
        {
            get { var id = new Dictionary<string, bool>();
            id.Add("village_Id", true);
            return id;
            }
        }
    }
}
